#include "Exception.h"

/**
Constructeur
@parma[in]	what	chaine decrivant l'exception
*/
Exception::Exception(const std::wstring& what)
: _what(what)
{
}

/**
Descruteur
*/
Exception::~Exception(void)
{
}

/**
@return description d'une exception
*/
std::wstring Exception::getWhat() const
{
	return _what;
}

/**
Conversion d'un std::wstring en std::string
@param[in]	str	chaine a convertir
@return chaine convertie
*/
std::string wstringTostring(const std::wstring &str )
{
	int size = str.size();
	char *szTmp = new char[size+1];
	wcstombs( szTmp, str.c_str(), size );
	szTmp[size] = '\0';
	std::string tmp = szTmp;
	delete []szTmp;
	return tmp;
}

/**
Conversion d'un std::string en std::wstring
@param[in]	str	chaine a convertir
@return chaine convertie
*/
std::wstring stringTowstring(const std::string &str )
{
	int size = str.size();
	wchar_t *szTmp = new wchar_t[size+1];
	mbstowcs( szTmp, str.c_str(), size );
	szTmp[size] = L'\0';
	std::wstring tmp = szTmp;
	delete []szTmp;
	return tmp;
}
